package com.xmh.myutil.entity;

import java.util.Date;
import java.math.BigDecimal;
import java.util.Map;
import java.util.HashMap;

import com.alibaba.fastjson.JSONObject;

import java.sql.Timestamp;

import lombok.Data;

import java.io.Serializable;

@Data
public class UserQianmeiEntity implements Serializable {

    /**
     * 版本号
     * 表备注：
     */
    private static final long serialVersionUID = 3742454219163453131L;

    /**
     *
     */
    private Integer id;

    /**
     *
     */
    private Integer userid;

    /**
     *
     */
    private String name;

    /**
     *
     */
    private String address;

    /**
     *
     */
    private String img1;

    /**
     *
     */
    private String img2;

    /**
     *
     */
    private String img3;

    /**
     *
     */
    private String imgAll;

    /**
     *
     */
    private String qq;

    /**
     *
     */
    private String wechat;

    /**
     *
     */
    private String phone;

    /**
     *
     */
    private Date updateDate;

    /**
     *
     */
    private Date createDate;

    @SuppressWarnings("unchecked")
    public UserQianmeiEntity(String json) {
        this(JSONObject.parseObject(json, Map.class));
    }

    public UserQianmeiEntity() {
    }

    public UserQianmeiEntity(Map<String, Object> map) {
        if (map == null || map.isEmpty()) {
            return;
        }

        if (map.get("id") != null) {
            id = Integer.valueOf(String.valueOf(map.get("id")));
        }

        if (map.get("userid") != null) {
            userid = Integer.valueOf(String.valueOf(map.get("userid")));
        }

        name = (String) map.get("name");

        address = (String) map.get("address");

        img1 = (String) map.get("img1");

        img2 = (String) map.get("img2");

        img3 = (String) map.get("img3");

        imgAll = (String) map.get("imgAll");

        qq = (String) map.get("qq");

        wechat = (String) map.get("wechat");

        phone = (String) map.get("phone");

        Object updateDateobj = map.get("updateDate");
        if (updateDateobj != null) {
            if (updateDateobj instanceof Date) {
                updateDate = (Date) updateDateobj;
            } else {
                updateDate = new Date((long) updateDateobj);
            }
        }

        Object createDateobj = map.get("createDate");
        if (createDateobj != null) {
            if (createDateobj instanceof Date) {
                createDate = (Date) createDateobj;
            } else {
                createDate = new Date((long) createDateobj);
            }
        }

    }

    public Map toMap() {
        Map map = new HashMap();
        map.put("id", id);
        map.put("userid", userid);
        map.put("name", name);
        map.put("address", address);
        map.put("img1", img1);
        map.put("img2", img2);
        map.put("img3", img3);
        map.put("imgAll", imgAll);
        map.put("qq", qq);
        map.put("wechat", wechat);
        map.put("phone", phone);
        map.put("updateDate", updateDate);
        map.put("createDate", createDate);
        return map;
    }


}